package com.zlcx.tz.live.domain.backup;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.zlcx.tz.live.domain.LiveRoomPublisherRecord;
import com.zlcx.tz.live.utils.DozerMapper;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.Date;

/**
 * <p>上麦记录</p>
 * <PRE>
 * <BR>    修改记录
 * <BR>-----------------------------------------------
 * <BR>    修改日期         修改人          修改内容
 * </PRE>
 * @author zl
 * @date Created in 2019/4/18 10:10
 * @version 1.0
 * @copyright: Copyright (c) founders
 */

@Data
@Entity(name = "live_room_publisher_record_backup")
@JsonSerialize
@DynamicUpdate
@DynamicInsert
public class LiveRoomPublisherRecordBackUpDO {

    @Id
    private Long id;
    /**
     * 房间id
     */
    private Long roomId;
    /**
     * 用户id
     */
    private Long userId;
    /**
     * 申请时间
     */
    private Date applyTime;
    /**
     * 同意时间
     */
    private Date agreeTime;
    /**
     * 退出时间
     */
    private Date quitTime;
    /**
     * 上麦状态
     *
     * @see com.zlcx.tz.live.constant.PublisherStatus
     */
    private Integer publisherState;

    private Date createTime;

    private Date updateTime;
    public static LiveRoomPublisherRecordBackUpDO from(LiveRoomPublisherRecord publisherRecord){
        LiveRoomPublisherRecordBackUpDO publisherRecordBackup = new LiveRoomPublisherRecordBackUpDO();
        DozerMapper.getInstance().map(publisherRecord, publisherRecordBackup);
        return publisherRecordBackup;
    }

    public static LiveRoomPublisherRecord from(LiveRoomPublisherRecordBackUpDO backup){
        LiveRoomPublisherRecord publisherRecord = new LiveRoomPublisherRecord();
        DozerMapper.getInstance().map(backup, publisherRecord);
        return publisherRecord;
    }

}